package com.roy.wakeupres.utils;

import java.util.Objects;

public class TestUtil {

    private final Integer num = 10;

    public static void main(String[] args) {

//        String a = "中文";
//        String b = "中文";
//        TestUtil testUtil1 = new TestUtil();
//        TestUtil testUtil2 = new TestUtil();
//
//        System.out.println(a.equals(b));
//        System.out.println(a==b);
//        System.out.println(testUtil1.equals(testUtil2));
//        System.out.println(Objects.equals(testUtil1,testUtil2));
//        System.out.println(testUtil1==testUtil2);
//        System.out.println(testUtil1);
//        System.out.println(testUtil2);

        Person p1 = new Person("Alice", 30);
        Person p2 = new Person("Alice", 30);
        Person p3 = new Person("Bob", 30);

        System.out.println(p1.hashCode());
        System.out.println(p2.hashCode());
        System.out.println(p3.hashCode());

        System.out.println(p1.equals(p2)); // 输出 true，因为p1和p2具有相同的name和age
        System.out.println(p1.equals(p3)); // 输出 false，因为p1和p3的name不同

        System.out.println(Objects.equals(p1, p2)); // 输出 true
        System.out.println(Objects.equals(p1, p3)); // 输出 false
    }
}
